package eg
{

    // Copyright (c) 2002 Cunningham & Cunningham, Inc.
    // Released under the terms of the GNU General Public License version 2 or later.

import com.fit4as.fit.ColumnFixture; 
import com.fit4as.fit.ScientificDouble;

public class ArithmeticColumnFixture extends ColumnFixture {

    public var x : int;
    public var y : int;

    public function plus() : int {
        return int(x + y);
    }

    public function minus() : int {
        return int(x - y);
    }

    public function times() : int {
        return int(x * y);
    }

    public function divide() : int {
        if (y == 0) throw new Error("Divide by zero");
        return int(x / y);
    }

    public function floating() : Number {
        return Math.round(x / y * 10000000) / 10000000;
    }

    public function sin() : ScientificDouble {
        return new ScientificDouble(Math.sin(toRadians(x)));
    }

    public function cos() : ScientificDouble {
        return new ScientificDouble(Math.cos(toRadians(x)));
    }

    private function toRadians(deg : Number) : Number
    {
        return deg * Math.PI / 180;
    }

}
}